using Sustainalytics.Universes.BusinessLogic;
using System;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Cors;

namespace Sustainalytics.Universes.Service.Controllers
{
    [EnableCors(origins: "*", headers: "*", methods: "*")]
    [RoutePrefix("api/v1/uploaderrorlogs")]
    public class UploadErrorLogsController : ApiController, IUploadErrorLogsController
    {
        private readonly IUniversesManagement _universesManagement;

        public UploadErrorLogsController(IUniversesManagement universeManagement)
        {
            try
            {
                _universesManagement = universeManagement;
            }
            catch (Exception ex)
            {
                throw;
            }
            
        }

        [HttpGet]
        [Route("")]
        public HttpResponseMessage Get()
        {
            try
            {
                return Request.CreateResponse(HttpStatusCode.OK, _universesManagement.GetUploadErrorLogs());
            }
            catch (Exception ex)
            {
                return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex);
            }
        }
    }
}
